$( document ).on( "pageshow", "#myFlowerDetail", function( event ) {
	access_token=getQueryString("access_token");
	type=getParameterByName("type",event.target.baseURI);

	pageNo="1";
	pageSize="10";
	$("#wrapper_myFlowerDetail  #pullDown").hide();
	
	var scrollObj_redFlowerRank=scrollPlugLoadedOfReturn("wrapper_myFlowerDetail",
			function() {
				setTimeout(function () {
					if(pageNo >= totalPage)
						return;
					pageNo++;
					loadData_Flower_Detail(false,type,scrollObj_redFlowerRank);
				}, 1000);	
			},
			function() {
//				setTimeout(function () {
//					pageNo=1;
//					loadData_redFlowerRank(true);
//				}, 1000);
				scrollObj_redFlowerRank.refresh();
			});
	
	loadData_Flower_Detail(true,type,scrollObj_redFlowerRank);
});

/**
 * 
 * @param isFresh 是否刷新
 * @param isFresh 是否是分页加载数据
 */
function loadData_Flower_Detail(isFresh,type,scrollObj_redFlowerRank){
	$.ajax({
	  	url: rootPath+"/redFlower/getAddRedFlowerInfo.do",
	  	type: "POST",
	  	dataType: "text",
		data: "access_token="+access_token+"&pageNo="+pageNo+"&pageSize="+pageSize+"&type="+type,
	  	success: function( response ) {
	  		var data=$.parseJSON(response);
			if(data.state=="200"){
				totalPage=data.data.totalPage;
		  		var totalRow=data.data.totalRow;
		  		var arr=data.data.rows;
				var content = "";
				for (var i=0;i<arr.length;i++){
					var man=arr[i].sendManName;
					var flower=rootPath+flower_;
					var flag="送给我一朵";
					if(arr[i].sendManName=="admin"){
						man="系统";
						flower=rootPath+"/images/weixin/flower/flower_01.png";
						flag="奖励我一个花瓣";
					}
					
					content+="<li data-icon=\"false\">"+
								  "<a href=\"#\">"+
									" <p >" +
								 	"<span style=\"font-size:15px;\">"+
										"<b>"+man+"</b>"+flag+"<img src=\""+flower+"\" width=\"30\" height=\"30\"/>" +
									"</span>"+
									"<strong class=\"ui-li-aside_fresh_new\">"+arr[i].createTime+"</strong>"+
								"</p>"+
								  "</a>"+
								"</li>";
				}
				if(arr.length<pageSize){
					$("#wrapper_myFlowerDetail  #pullUp").hide();
				}else{
					$("#wrapper_myFlowerDetail  #pullUp").show();
				}
				if(isFresh && $("#thelist_myFlowerDetail").html()!=""){
					$("#thelist_myFlowerDetail").html("");
				}
				$("#thelist_myFlowerDetail").append(content).listview('refresh');
				
				scrollObj_redFlowerRank.refresh();
				
			}else{
				alert_wx('fail',data.msg);
			}
	  	}
	});
}

